import selfApi from "@/apis/selfApi"
import userApi,{ ILoginData, User } from "@/apis/userApi"
import { CacheEnum } from "@/enum/userEnum"
import store from "@/utils/store"
import { defineStore} from "pinia"

export default defineStore('attention',{
    state:()=>{
        return {
             isAttention:false ,
             isCollection:false,
             collectionBokInfo:[]  as any,
             pageNum:1 as number,
             totalPages:1 as number,

        }
    },
    actions:{ 
        async getCollectionBokByUid(pageNum:any,u_id:any){
            this.collectionBokInfo= (await selfApi.getAttention(pageNum,u_id)).data  as []
            console.log(this.collectionBokInfo);
            this.pageNum= this.collectionBokInfo?.currentPage;
            this.totalPages= this.collectionBokInfo?.page_count;
            return this.collectionBokInfo
         },
    },
    persist:{
        key:'attentioninfo',
        storage:sessionStorage
   }
 
})